Skip to content

IntLineEdit

Base classes

Name Children Inherits
LineEdit
prettyqt.widgets.lineedit
One-line text editor.

⋔ Inheritance diagram

graph TD
  4228419578["custom_widgets.IntLineEdit"]
  1980365965["widgets.LineEdit"]
  829357528["widgets.WidgetMixin"]
  3227531497["core.ObjectMixin"]
  2751680898["builtins.object"]
  625385617["gui.PaintDeviceMixin"]
  1326755038["QtWidgets.QLineEdit"]
  3620195106["QtWidgets.QWidget"]
  3984060476["QtCore.QObject"]
  37984305["Shiboken.Object"]
  673956333["QtGui.QPaintDevice"]
  1980365965 --> 4228419578
  829357528 --> 1980365965
  3227531497 --> 829357528
  2751680898 --> 3227531497
  625385617 --> 829357528
  2751680898 --> 625385617
  2751680898 --> 829357528
  1326755038 --> 1980365965
  3620195106 --> 1326755038
  3984060476 --> 3620195106
  37984305 --> 3984060476
  2751680898 --> 37984305
  673956333 --> 3620195106
  37984305 --> 673956333

🛈 DocStrings

Bases: LineEdit

Source code in prettyqt/custom_widgets/editors/lineedits.py
class IntLineEdit(widgets.LineEdit):
    value_changed = core.Signal(int)

    def __init__(self, *args, object_name: str = "int_lineedit", **kwargs):
        super().__init__(*args, object_name=object_name, **kwargs)
        self.set_validator("integer", bottom=0, top=1000000000)

    def get_value(self) -> int:
        val = super().get_value()
        return int(val) if val and val.isnumeric() else 0

    def set_value(self, value: int | str):
        super().set_value(str(value))

    value = core.Property(
        int,
        get_value,
        set_value,
        doc="Current Value as integer",
    )

:fa-brands-github: Show source on GitHub